//package com.demo;
//
//import org.apache.flink.api.common.typeinfo.TypeInformation;
//import org.apache.flink.api.java.typeutils.RowTypeInfo;
//import org.apache.flink.table.api.TableSchema;
//import org.apache.flink.table.functions.AsyncTableFunction;
//import org.apache.flink.table.functions.TableFunction;
//import org.apache.flink.table.sources.LookupableTableSource;
//import org.apache.flink.table.types.DataType;
//import org.apache.flink.table.types.utils.TypeConversions;
//import org.apache.flink.types.Row;
//
//@Deprecated
//public class RedisAsyncLookupTableSource implements LookupableTableSource<Row> {
//
//  private final String[] fieldNames;
//  private final TypeInformation[] fieldTypes;
//  private final String redisUrl;
//
//  public RedisAsyncLookupTableSource(String[] fieldNames,
//      TypeInformation[] fieldTypes, String redisUrl) {
//    this.fieldNames = fieldNames;
//    this.fieldTypes = fieldTypes;
//    this.redisUrl = redisUrl;
//}
//
//  //同步方法
//  @Override
//  public TableFunction<Row> getLookupFunction(String[] strings) {
//    return null;
//  }
//
//  //异步方法
//  @Override
//  public AsyncTableFunction<Row> getAsyncLookupFunction(String[] strings) {
//    return RedisAsyncLookupFunction.Builder.getBuilder()
//        .redisUrl(redisUrl)
//        .withFieldNames(fieldNames)
//        .withFieldTypes(fieldTypes)
//        .build();
//  }
//
//  //开启异步
//  @Override
//  public boolean isAsyncEnabled() {
//    return true;
//  }
//
//  @Override
//  public DataType getProducedDataType() {
//    return TypeConversions.fromLegacyInfoToDataType(new RowTypeInfo(fieldTypes, fieldNames));
//  }
//
//  @Override
//  public TableSchema getTableSchema() {
//    return TableSchema.builder()
//        .fields(fieldNames, TypeConversions.fromLegacyInfoToDataType(fieldTypes))
//        .build();
//  }
//
////  @Override
////  public DataStream<Row> getDataStream(StreamExecutionEnvironment environment) {
////    throw new UnsupportedOperationException("do not support getDataStream");
////  }
//
//  public static final class Builder {
//
//    private String[] fieldNames;
//    private TypeInformation[] fieldTypes;
//    //仅仅是为了方便传递redis地址
//    private String redisUrl;
//
//    private Builder() {
//    }
//
//    public static Builder newBuilder() {
//      return new Builder();
//    }
//
//    public Builder withFieldNames(String[] fieldNames) {
//      this.fieldNames = fieldNames;
//      return this;
//    }
//
//    public Builder withFieldTypes(TypeInformation[] fieldTypes) {
//      this.fieldTypes = fieldTypes;
//      return this;
//    }
//
//    public Builder redisUrl(String redisUrl) {
//      this.redisUrl = redisUrl;
//      return this;
//    }
//
//    public RedisAsyncLookupTableSource build() {
//      return new RedisAsyncLookupTableSource(fieldNames, fieldTypes,redisUrl);
//    }
//  }
//}
//
//
